package com.pan.admin.module.visualizer.controller;

import com.pan.admin.common.core.controller.BaseController;
import com.pan.admin.common.core.page.TableDataInfo;
import com.pan.admin.module.datareport.entity.StartTimeAndEndTime;
import com.pan.admin.module.visualizer.entity.vo.LoanChannelVisualizerVO;
import com.pan.admin.module.visualizer.entity.vo.LoanMarketDetailVO;
import com.pan.admin.module.visualizer.service.LoanChannelVisualizerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * H5/APP渠道
 *
 * @author caoxin
 */
@RestController
public class LoanChannelVisualizerController extends BaseController {

    @Autowired
    private LoanChannelVisualizerService loanChannelVisualizerService;

    /**
     *  H5/APP渠道统计
     *
     *  @param  startTimeAndEndTime
     *  @param  name
     *  @return TableDataInfo
     */
    @GetMapping("/visualizer/loanChannel/list")
    @PreAuthorize("@ss.hasPermi('visualizer:loanChannel:list')")
    public TableDataInfo list(StartTimeAndEndTime startTimeAndEndTime, @RequestParam(required = false) String name) {
        List<LoanChannelVisualizerVO> list = this.loanChannelVisualizerService.list(startTimeAndEndTime, name);
        return getDataTable(list);
    }

    /**
     * 贷超详情
     */
    @GetMapping("/visualizer/loanChannel/list/listLoanMarketDetail")
    @PreAuthorize("@ss.hasPermi('visualizer:loanChannel:list')")
    public TableDataInfo listLoanMarketDetail(StartTimeAndEndTime startTimeAndEndTime, @RequestParam(required = false) Long id) {
        startPage();
        List<LoanMarketDetailVO> list = this.loanChannelVisualizerService.listLoanMarketDetail(startTimeAndEndTime, id);
        return getDataTable(list);
    }

}
